package com.controller;

import com.entry.Product;
import com.entry.Product_image;
import com.server.impl.ProductServiceImpl;
import com.server.impl.ProductimageServiceImpl;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class DetailController {

    @Resource
    ProductimageServiceImpl productimageService;
    @Resource
    ProductServiceImpl productService;
    //请求到detail界面
    @RequestMapping(value = "/detail/getdetail")
    public String getdetail(Integer product_id, Model model){
        System.out.println("product_id="+product_id);
        Product product_id1=productService.getproductByProduct_id(product_id);
        model.addAttribute("product_id1", product_id1);
        List<Product_image> product_imageList=productimageService.getProductimageByProduct_id(product_id);
        model.addAttribute("product_imageList", product_imageList);
        List<Product> productListimgandproduct=productService.getproducandproductimageList();
        model.addAttribute("productListimgandproduct",productListimgandproduct);
        System.out.println("product_id1="+product_id1);
        System.out.println("product_imageList="+product_imageList);
        System.out.println("productListimgandproduct="+productListimgandproduct);
        return "detail";
    }

}

